home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 2.7 KB | 101 lines | [TEXT/MPS ] |
-
- PROGRAM ReleaseTst;
-
- USES Quickdraw,MemTypes,SysEqu,ToolUtils,Resources,Dialogs,OSUtils,Retrace,Fonts,OSEvents,
- Windows,menus;
-
- CONST
- iAnimate = 1;
- iQuit = 2;
- iUser1 = 3;
- iUser2 = 4;
-
- VAR
- item : handle;
- err,itemType,itemHit : integer;
- MyDialog : DialogPtr;
- theRect : rect;
- animating,quit : boolean;
- Counter : byte;
- CurTicks : longint;
- theEvent : EventRecord;
-
- {------------------------------------------------------------------------------------}
-
- PROCEDURE InitMac;
-
- BEGIN {InitMac}
-
- {UnLoadSeg(@_DataInit);} {remove data initialization code before any allocations}
- InitGraf(@thePort); {initialize QuickDraw}
- InitFonts; {initialize Font Manager}
- FlushEvents(everyEvent, 0); {call OS Event Mgr to discard any previous events}
- InitWindows; {initialize Window Manager}
- InitMenus; {initialize Menu Manager}
- TEInit; {initialize TextEdit}
- InitDialogs(NIL); {initialize Dialog Manager}
- InitCursor; {call QuickDraw to make cursor (pointer) an arrow}
- quit := false; {always initialize them booleans!}
- animating := false;
- Counter := $21;
-
- END; {InitMac}
-
- {------------------------------------------------------------------------------------}
-
- BEGIN {main PROGRAM}
-
- InitMac;
- MyDialog := GetNewDialog (1,nil,pointer(-1));
- if MyDialog <> nil then
- begin
- SetPort(MyDialog);
- GetDItem (MyDialog,iUser1,itemType,item,theRect);
- FrameRect (theRect);
- TextFont (helvetica);
- TextSize (14);
- moveTo ((theRect.topleft.h)+10,(theRect.topleft.v)+15);
- DrawString ('Welcome To TickAnimator');
- GetDItem (MyDialog,iUser2,itemType,item,theRect);
- FrameRect (theRect);
- insetRect (theRect,3,3);
- TextFont (helvetica);
- TextSize (24);
- moveTo ((theRect.topleft.h)+10,(theRect.topleft.v)+20);
- DrawString ('Cameron Birse - 1990');
- SetFontLock (true);
- err := noerr;
- CurTicks := tickcount;
- repeat
- if WaitNextEvent (EveryEvent,theEvent,1,nil) then
- if isDialogEvent (theEvent) then
- if DialogSelect (theEvent,MyDialog,itemHit) then
- case itemHit of
- iAnimate : if not animating then animating := true else
- if animating then
- begin
- eraseRect (theRect);
- moveTo ((theRect.topleft.h)+10,(theRect.topleft.v)+20);
- DrawString ('Cameron Birse - 1990');
- animating := false;
- end;
- iQuit : quit := true;
- end; {case}
- if CurTicks < (TickCount-8) then
- begin
- CurTicks := TickCount;
- if animating then
- begin
- eraseRect (theRect);
- moveTo ((theRect.topleft.h)+10,(theRect.topleft.v)+20);
- DrawChar (char(Counter));
- Counter := Counter + 1;
- if Counter > $AA then Counter := $21;
- end;
- end;
- until quit;
- SetFontLock (false);
- TextFont (systemFont);
- TextSize (12);
- end;
- END.